#!/bin/bash

#**************************************************************
#*                                                            *
#*      cleanup_files                                         *
#*                                                            *
#**************************************************************

function cleanup_files {
#
rm -f  *_out 
rm -f  *~ >& /dev/null
rm -f energy  >& /dev/null
rm -f *_db >& /dev/null
rm -f wn*  >& /dev/null
rm -f we*  >& /dev/null
rm -f step*.rest  >& /dev/null
rm -f cvn.batch_messages >& /dev/null
rm -f states* >& /dev/null
#
}

#**************************************************************
#*                                                            *
#*      run_and_compare                                       *
#*                                                            *
#**************************************************************

function run_and_compare {
#
echo "  ... running MPI + MKL sparse iterative solver (threads)..."
export MKL_NUM_THREADS=4
"$warp3d" $ranks_warp3d $threads_warp3d < test_tr > test_tr_out
#
echo "  ... WARP3D job completed ..."
#
# Check
#
perl check.perl
#
# cleanup_files
printf ">>> All done with test for MPI + MKL\n"
cleanup_files
#
}

#**************************************************************
#*                                                            *
#*      Main program                                          *
#*                                                            *
#**************************************************************
run_and_compare
